<?php if ($error != ''): ?>
    <ul class="message error">
        <?php if ($error != ''): ?>
            <li><?php echo $error ?></li>
        <?php endif; ?>
        <?php echo form_error('upload') ?>
    </ul>
<?php endif; ?>
<?php if($success != ''): ?>
<ul class="message success">
    <li><?php echo $success; ?></li>
</ul>
<?php endif; ?>
<div class="ad-preview" style="width: 860px; min-height:170px;overflow-x: hidden">
    <p>Banner hiện tại đang sử dụng</p>
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="860" HEIGHT="100" id="<?php echo STATIC_DOMAIN ?>images/default/BannerGiaHuy.swf" ALIGN="">
        <PARAM NAME=movie VALUE="<?php echo STATIC_DOMAIN . preg_replace('/^\/(.*)$/', '$0', $bannerInfo) ?>"> 
        <PARAM NAME=quality VALUE=high> 
        <PARAM NAME=bgcolor VALUE=#333399> 
        <EMBED src="<?php echo STATIC_DOMAIN . preg_replace('/^\/(.*)$/', '$0', $bannerInfo) ?>" quality=high bgcolor=#333399 WIDTH="860" HEIGHT="100" NAME="<?php echo STATIC_DOMAIN . preg_replace('/^\/(.*)$/', '$0', $bannerInfo) ?>" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> 
    </OBJECT>
</div>
<form class="form has-validation" method="POST" action="" style="width: 600px;float:left;margin-top: 10px;">
    <input type="hidden" name="frmToken" id="frmToken" value="<?php echo $frmToken ?>"/>
    <div class="clearfix">
        <label for="form-upload" class="form-label">Ảnh quảng cáo<small>Chiều rộng tối đa của file phải nhỏ hơn 860px</small></label>
        <div class="form-input">
            <input type="text" id="form-upload" name="upload" value="<?php echo $bannerInfo ?>" required="required"/></div>
    </div>

    <div class="form-action clearfix">
        <input class="button" type="submit" name="submit" data-icon-primary="ui-icon-circle-check" value="Lưu thay đổi"/>
    </div>
</form>

<script type="text/javascript">
    function initFinder() 
    {
        $("#form-upload").click(function() {
            var finder = new CKFinder( { width : 600 } ),
                obj = $(this),
                preview  = $("#img-preview");
            finder.selectActionFunction = function(fileUrl, data) {
                obj.val(fileUrl);
                preview.attr('src' , base_url + fileUrl);
            };
            finder.basePath = '/Flash/';
            finder.resourceType = "Flash";
            finder.popup(800,600);
        });
    }
    $(document).ready(function() {
        initFinder();
    });
     
</script>
   